import java.awt.*;

import javax.swing.*;

class BackgroundPanel extends JPanel {
  Image image;
  public BackgroundPanel(String img)
  {
	  image = ImageDB.images.get(img);
	  while(image.getWidth(null) == -1);
	  this.setSize(new Dimension(image.getWidth(null), image.getHeight(null)));
	  this.setMinimumSize(new Dimension(image.getWidth(null), image.getHeight(null)));
	  this.setPreferredSize(new Dimension(image.getWidth(null), image.getHeight(null)));
	  this.setMaximumSize(new Dimension(image.getWidth(null), image.getHeight(null)));    
  }

  @Override
  protected void paintComponent(Graphics g)
  {
    super.paintComponent(g); 
    if (image != null)
      g.drawImage(image, 0,0,this.getWidth(),this.getHeight(),this);
  }
}